<?php

namespace eu\freeplace\page\model;


class ValueObject {

    const CLASS_NAME = "ValueObject";

    public function __construct() {
        global $logger;
        $logger->log("Calling instance of ".self::CLASS_NAME."()", "NOTICE");
    }

    protected function getResult($sql, $dbh) {
        global $dbh;

        try {
            if($dbh == "")
                throw new PDOException("No Database Connection.");

            $statement = $dbh->query($sql);
            //Exception by empty SQL Result
            if ($statement == false)
                throw new PDOException("No Data fetched.");

        } catch (PDOException $e) {
            $statement = $e->getMessage();
        }
        return $statement;
    }

    protected function getTablePrefix() {
           global $config;
           return $config->core->database->prefix['value'];
    }
}//CLASS

?>
